L=1000000000; S=3; T=5; M=100; stones=[119108517,119108519,119108521,119108522,119108518,119108523,7330813,119108516,40394400,810630073,119108520,435150209,983795707,119108525,460758185,119108515,119108524,147449005,47314756,523250218,3568016,3568024,3568015,3568021,3568022,3568019,901731521,3568018,247224133,515587801,486569601,3568020,282184681,3568014,32381269,570868866,9443323,316334901,167588029,668949776,255861625,255861622,255861616,255861618,255861626,325035031,180570826,255861620,493822129,107249842,406586290,550560625,372291841,141001441,38515915,13424840,124348477,23263221,623632470,290897883,43168086,43168091,62985755,43168082,43168089,43168090,43168081,187576501,168613305,39023161,43168087,43168084,43168085,456898234,10790741,510130324,3471859,422267,592211029,134135152,25657881,25657886,25657887,25657889,25657891,25657882,182313098,364732829,45163681,437572144,258360505,25657888,64966903,225658384,25657884,301058545,27893449,596266273,39505741,89161801];